<style type="text/css">
#navcontainer { width: 240px; }

#navcontainer ul
{
margin-left: 0;
padding-left: 0;
list-style-type: none;
font-family: Arial, Helvetica, sans-serif;
}

#navcontainer a
{
display: block;
padding: 3px;
width: 220px;
background-color: #036;
border-bottom: 1px solid #eee;
}

#navcontainer a:link, #navlist a:visited
{
color: #EEE;
text-decoration: none;
}

#navcontainer a:hover
{
background-color: #369;
color: #fff;
}
</style>
<table width="100%">
<tr>
  <td valign="top" width="250px">
    <%=render :partial=>"trophy_menu"%>
  </td>
  <td valign="top">
    <h2>Maximum- Sold Units</h2><br/>
    <table width="90%" style="border: 3px solid black; font-size: 30px;">
    <tr align="center" style="border: 3px solid black;" bgcolor="#cccccc">
      <th>Player</th>
      <th>Sold Units</th>
      <th>Rank</th>
    </tr>
    <%
      a_val_array = Array.new
      b_val_array = Array.new
      @players.each do |p|
        sold_unit = PlayerBalance.sum(:sold_unit, :conditions=>["player_id=? AND year<=? AND year>0", p.id, @game.current_year-1])
        if p.player_type=='B'
          b_val_array = b_val_array << sold_unit
        else
          a_val_array = a_val_array << sold_unit
        end
      end
      a_rank = array_rank_desc(a_val_array)
      b_rank = array_rank_desc(b_val_array)
    %>
    <%@players.each_with_index do |p,i|%>
      <%sold_unit = PlayerBalance.sum(:sold_unit, :conditions=>["player_id=? AND year<=? AND year>0", p.id, @game.current_year-1])%>
      <%if p.player_type=='B'%>
        <tr align="right" bgcolor="#FFDDDD">
      <%else%>
        <tr align="right" bgcolor="#CCEEFE">
      <%end%>
        <td align="left"><%=p.name%></td>
        <td><%=number_with_delimiter(sold_unit)%></td>
        <td align="center">
          <%if p.player_type=='B'%>
            <%=b_rank[i]%>
          <%else%>
            <%=a_rank[i-(@players.length/2)]%>
          <%end%>
        </td>
      </tr>
    <%end%>
  </table>
  </td>
</tr>
</table>